<?php
$clientsbyid = array();
foreach($clients as $client){
	$clientsbyid[$client['Client']['id']] = $client['Client']['title'];
}
unset($clients);
?>

<h2>tasks: <?php echo $clientsbyid[$client_id]; ?> </h2>

<ul class="submenu">
<li><?php echo $this->Html->link('View',array('controller' => 'tasks', 'action' => 'index', $client_id)); ?></li>
<li><?php echo $this->Html->link('New',array('controller' => 'tasks', 'action' => 'add', $client_id)); ?></li>
</ul>

<table>
    <tr>
        <th>Id</th>
        <th>Name</th>
        <th>State</th>
        <th colspan="2">Action</th>
        <th>Modified</th>
        <th>Created</th>
    </tr>

    <!-- Here is where we loop through our $posts array, printing out post info -->

    <?php foreach ($tasks as $task): ?>
    <tr>
        <td><?php echo $task['Task']['id']; ?></td>
        <td><?php echo $task['Task']['title']; ?>
        </td>
        <td><?php echo $task['Task']['publish']; ?></td>
        <td><?php echo $this->Form->postLink('Delete',
                array('action' => 'delete', $task['Task']['id'], $client_id),
                array('confirm' => 'Are you sure?'));?></td>
                
        <td><?php echo $this->Html->link('edit',
				array('controller' => 'tasks', 'action' => 'edit', $client_id, $task['Task']['id'])); ?></td>
                
        <td><?php echo $task['Task']['modified']; ?></td>
        <td><?php echo $task['Task']['created']; ?></td>
    </tr>
    <?php endforeach; ?>
    <?php unset($task); ?>
</table>